package com.modemMgr.util;

import javax.servlet.http.HttpServletRequest;

public class PageHelper {
	public static Pager getPager(HttpServletRequest request)
	{
		Pager pager = new Pager();
		pager.setPath(request.getContextPath()+ request.getServletPath());
		pager.setMethod(request.getParameter("method"));
		request.setAttribute("pager", pager);
		String totalRows = request.getParameter("totalRows");
		
		if (null != totalRows)
		{
			pager.setTotalRows(Integer.parseInt(totalRows));
			pager.setCurrentPage(Integer.parseInt(request.getParameter("currentPage")));
		}
		
		return pager;
	}
}
